Introduction

The two words I chose were “Flying” and “Squirrel”. The reason I chose these words is because in the project outline “cute cats” was used as an example so I chose a different animal and chose an adjective.

The first few rows of the results from the search engine
The first few rows of the results from the search engine


The photos tend to all be landscape photos. All of them tend to have primarily green and brown colours in them. All of them are tagged with ‘squirrel’ and most of them are tagged with ‘rodent’. The likes on the photos tend to vary from around 120 - 220 likes. The range on the number of views is quite large with half being around 110,000 and the other half having around 10,000.

selected_urls <- select(photo_data, pageURL)
knitr::kable(selected_urls, caption = "Selected Photo URLs")
Selected Photo URLs
pageURL
https://pixabay.com/photos/nature-rodent-squirrel-mammal-7997402/
https://pixabay.com/photos/squirrel-rodent-animal-mammal-4515962/
https://pixabay.com/photos/squirrel-rodent-mammal-wildlife-7706132/
https://pixabay.com/photos/squirrel-animal-rodent-nature-7484292/
https://pixabay.com/photos/squirrel-rodent-mammal-wildlife-7678830/
https://pixabay.com/photos/red-squirrel-rodent-animal-squirrel-570936/
https://pixabay.com/photos/squirrel-rodent-drinking-fountain-7367445/
https://pixabay.com/photos/squirrel-rodent-foraging-wildlife-498139/
https://pixabay.com/photos/squirrel-rodent-animal-6949263/
https://pixabay.com/photos/tihany-squirrel-rodent-wildlife-7403356/
https://pixabay.com/photos/squirrel-chipmunk-rodent-animal-5506514/
https://pixabay.com/photos/animal-squirrel-rodent-cute-fur-5072537/
https://pixabay.com/photos/squirrel-rodent-animal-cute-nature-5158715/
https://pixabay.com/photos/chipmunk-animal-rodent-mammal-5795916/
https://pixabay.com/photos/squirrel-rodent-wildlife-forest-4142446/
https://pixabay.com/photos/squirrel-rodent-foraging-eating-6365603/
https://pixabay.com/photos/squirrel-rodent-foraging-eating-4700919/
https://pixabay.com/photos/squirrel-rodent-foraging-eating-4310069/
https://pixabay.com/photos/squirrel-rodent-animal-furry-80575/
https://pixabay.com/photos/squirrel-rodent-foraging-wildlife-1850210/
https://pixabay.com/photos/squirrel-rodent-wildlife-forest-6916189/
https://pixabay.com/photos/squirrel-rodent-wildlife-forest-4466632/
https://pixabay.com/photos/squirrel-rodent-wildlife-forest-6846096/
https://pixabay.com/photos/squirrel-rodent-wildlife-forest-6530649/
https://pixabay.com/photos/squirrel-rodent-wildlife-forest-4612799/
https://pixabay.com/photos/squirrel-rodent-foraging-eating-2371509/
https://pixabay.com/photos/squirrel-rodent-wildlife-forest-4605518/
https://pixabay.com/photos/squirrel-rodent-foraging-eating-3662681/
https://pixabay.com/photos/squirrel-rodent-mammal-wildlife-7875123/
https://pixabay.com/photos/squirrel-rodent-wildlife-mammal-7889170/
https://pixabay.com/photos/squirrel-rodent-mammal-animal-8044947/
https://pixabay.com/photos/squirrel-rodent-animal-wildlife-7717592/
https://pixabay.com/photos/squirrel-rodent-mammal-wildlife-7778318/
https://pixabay.com/photos/squirrel-rodent-animal-mammal-7246270/
https://pixabay.com/photos/squirrel-rodent-animal-mammal-7552211/
https://pixabay.com/photos/squirrel-rodent-animal-wildlife-7700444/
https://pixabay.com/photos/squirrel-rodent-wildlife-mammal-7494809/
https://pixabay.com/photos/squirrel-rodent-animal-mammal-7517034/
https://pixabay.com/photos/squirrel-oak-kitten-rodent-meal-7291826/
https://pixabay.com/photos/squirrel-rodent-animal-mammal-7497278/
https://pixabay.com/photos/squirrel-rodent-wildlife-mammal-7376177/
https://pixabay.com/photos/squirrel-rodent-wildlife-mammal-7439862/
https://pixabay.com/photos/squirrel-rodent-wildlife-mammal-7355050/
https://pixabay.com/photos/squirrel-rodent-wildlife-mammal-7414955/
https://pixabay.com/photos/squirrel-garden-rodent-wildlife-7333350/
https://pixabay.com/photos/squirrel-rodent-wildlife-mammal-7208503/
https://pixabay.com/photos/squirrel-animal-rodent-nature-cute-3682846/
https://pixabay.com/photos/squirrel-rodent-wildlife-forest-7345957/
https://pixabay.com/photos/squirrel-rodent-animal-5603496/
https://pixabay.com/photos/squirrel-oak-kitten-rodent-animal-4318302/
https://pixabay.com/photos/squirrel-rodent-looking-for-food-7299553/
https://pixabay.com/photos/squirrel-rodent-garden-mammal-7339496/
https://pixabay.com/photos/squirrel-oak-kitten-rodent-animal-5331083/
https://pixabay.com/photos/squirrel-rodent-mammal-foraging-7303984/
https://pixabay.com/photos/squirrel-oak-kitten-rodent-animal-5233121/
https://pixabay.com/photos/squirrel-rodent-foraging-wildlife-5959490/
https://pixabay.com/photos/squirrel-rodent-wildlife-forest-5941614/
GIF of all Selected Photos
GIF of all Selected Photos

Key features of selected photos

  1. On average there was a 86.0643218% chance that if the person viewed the image they would also download it.

  2. The chance that a person would leave a comment on a photo was 0.1356391% on average.

  3. The average number of likes for the selected photos is 156, indicating the level of engagement they receive from viewers.

  4. The average number if views for the selected photos were 41129.35

Creativity

ggplot(photo_data, aes(x = views, y = comments)) +
geom_point(color = "blue", alpha = 0.5) +
labs(title = "Views vs. Comments for Selected Photos",
       x = "Views", y = "Comments") 

ggplot(photo_data, aes(x = views, y = downloads)) +
geom_point(color = "blue", alpha = 0.5) +
labs(title = "Views vs. Downloads for Selected Photos",
       x = "Views", y = "Downloads") 

To demonstrate creativity I have made some scatter plots to show the relationship between views with comments and downloads. I had to look into how to make scatter plots as only bar graphs were taught in lectures.

Learning reflection

One important idea I learned from module 3 was the creation of new variables using old variables. This idea is important because sometimes the original variables that you have gathered are not that useful for interpretation. But if we look at the means or medians of those variables or use ifelse to categorise them, they can become more useful to us.

Something I am curious about that I would like to explore is seeing what other websites out there have search APIs up and available for people to use. I think it would be cool to see what you could do with these APIs and how they are used in the world today.

Appendix

library(tidyverse)
library(magick)
library(jsonlite)

#read json data into frame 
json_data <- fromJSON("pixabay_data.json")
pixabay_photo_data <- json_data$hits

#filter photos down to around 50 and also create more variables 
selected_photos <- pixabay_photo_data %>% 
  separate_rows(tags, sep = ", ") %>%
  filter(tags == 'rodent' & views > 10000 & downloads > 15000)%>%
  mutate(popular = ifelse(views > 100000, 'very popular', 'not that popular'))%>%
  mutate(viewsvsdownloads = (downloads / views)) %>%
  mutate(viewsvscomments = comments / views)

#saves as CSV 
write_csv(selected_photos, "selected_photos.csv")


mean_likes <- selected_photos$likes %>% mean(na.rm = TRUE)
mean_views <- selected_photos$views %>% mean(na.rm = TRUE)
mean_comments <- selected_photos$comments %>% mean(na.rm = TRUE)

selected_photos %>%
  group_by(popular) %>%
  summarise(mean_likes = mean(likes))

selected_photos %>%
  group_by(popular) %>%
  summarise(mean_views = mean(views))

selected_photos %>%
  group_by(popular) %>%
  summarise(mean_comments = mean(comments))

  # Initialize an empty list to store resized images
  images <- list()
  
  # Loop through each URL in selected_photos$previewURL
  for (url in selected_photos$previewURL) {
    # Read and resize each image
    img <- image_read(url)
    img_resized <- image_resize(img, "300x300")
    # Add the resized image to the list
    images <- c(images, list(img_resized))
  }
  
  # Combine images into an animated GIF
  animated_gif <- image_animate(image_join(images), fps = 5)
  
  # Save the animated GIF
  image_write(animated_gif, "my_photos.gif")